<template>
  <div class="agreeadd">
    <div class="fan" @click="router.go(-1)"><button @click="edit">保存</button></div>
         <div class="fan" @click="router.go(-1)"><button>返回</button></div>
      <!-- hahah -->
      序号：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" v-model="id"><br>
      合同编号：<input type="text" v-model="name"><br>
      合同名称：<input type="text" v-model="phone"><br>
      合同类型：<input type="text" v-model="address"><br>
      负责人：&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" v-model="email"><br>
      生效日期：&nbsp;<input type="text" v-model="age"><br>
     失效日期： <input type="text" v-model="sex"><br>
      <button @click="add">保存</button>
  </div>
</template>

<script setup>
    import { ref } from 'vue';
    import axios from 'axios';
    import { useRoute, useRouter } from 'vue-router';
       var route = useRoute();
       var router = useRouter();
    var id = ref();
    var name = ref();
    var phone = ref();
    var address = ref();
    var email = ref();
    var age = ref();
    var sex = ref();
    var addarr = ref({
        id:id.value,
        name:name.value,
        phone:phone.value,
        address:address.value,
        email:email.value,
        age:age.value,
        sex:sex.value,
        // addarr:addarr,
    })


   var  add = ()=>{
       axios.post('/api/user/add',{ id:id.value,
        name:name.value,
        phone:phone.value,
        address:address.value,
        email:email.value,
        age:age.value,
        sex:sex.value,}).then((res)=>{
            router.push('/index/agreement')
           console.log(res.data)
       })
     
   }

</script>

<style>

</style>